package nju.mscs.data.object;

import java.io.Serializable;

public class TotalGiftPromotion extends Promotion implements Serializable, GiftPromotion,TotalPromotion {
	
	private double min,max;
	private Gift gift;
	
	public TotalGiftPromotion(String id,double min,double max,Gift gift,Date begin,Date over){
		super(id,Promotion.TotalGiftPromotion,begin,over);
		setTotal(min,max);
		this.gift = gift;
	}
	
	
	@Override
	public boolean check(double total) {
		if((this.max>total||this.max==0)&&this.min<total)
			return true;
		return false;
	}

	@Override
	public Gift getGift() {
		return gift;
	}
	@Override
	public void setTotal(double min, double max) {
		this.max = max;
		this.min = min;
	}


	@Override
	public String getTotal() {
		// TODO Auto-generated method stub
		return this.min+"~"+this.max;
	}
	@Override
	public double getMax() {
		// TODO Auto-generated method stub
		return max;
	}


	@Override
	public double getMin() {
		// TODO Auto-generated method stub
		return min;
	}
}
